<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
</head>
<body>
	<script type="text/javascript">
		//new target
		class Person{
			constructor(){
				console.log(new.target.name);
			}
		}
		new Person();

		class Man extends Person{
			constructor(){
				super();
			}
		}
		new Man();

		//
		class Uncle{
			constructor(){
				if(new.target === Uncle){
					throw new Error('这个类不能实例化，只能通过集成')
				}
			}
			showUncle(){
				console.log('都是他就');
			}
		}

		//new Uncle();
		class BigUncle extends Uncle{
			constructor(){
				super();
				this.uncle = '他大舅';
			}
		}
		const uncle = new BigUncle();
		uncle.showUncle();

		//get and set
		class Pop{
			get att(){
				return '你获取了';
			}
			set att(value){
				console.log(`你设置了${value}`);
			}
		}

		const p1 = new Pop();
		console.log(p1.att);
		p1.att = '名字';
	</script>
</body>
</html>